import { createApp } from 'vue'

import App from './App.vue'
import router from './routers'
import pinia from '@/store/index'

import ElementPlus from 'element-plus'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import zhCn from "element-plus/es/locale/lang/zh-cn";
import 'element-plus/dist/index.css'

import registerGlobComp from './components'
/** 加载异步路由 */
import '@/routers/initDynamicRouter'
// 公共样式，包含自定义暗黑模式，element重置样式
import '@/styles/index.scss'

import directives from '@/directives/index'

import * as echarts from 'echarts';

import "amfe-flexible/index.js";

const app = createApp(App);
app.use(registerGlobComp);
app.use(directives);
app.config.globalProperties.$echarts = echarts;
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}
app.use(router).use(pinia).use(ElementPlus, { locale: zhCn , size: 'small', zIndex: 2000 }).mount('#app')
